#coding='utf-8'
from appium import webdriver
'''
Created on Dec 8, 2015

@author: DQA  wangpeng
'''
import unittest
import time
from appium import webdriver
import data.desired_setting

#configuration
class uninstall_install(unittest.TestCase):
    def setUp(self):
        desired_caps = data.desired_setting.desired_setting()
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
    
    def tearDown(self):
        time.sleep(3)
        #self.driver.quit()

    def test_install_app(self):
        #self.assertFalse(self.driver.is_app_installed('com.TONLYELE.YDMusicBox'))
        self.driver.install_app('/Users/DQA/Desktop/YDMusicBox.ipa')
        self.assertTrue(self.driver.is_app_installed("com.TONLYELE.YDMusicBox"))
 
    def test_remove_app(self):
        self.assertTrue(self.driver.is_app_installed('com.TONLYELE.YDMusicBox'))
        self.driver.remove_app('com.TONLYELE.YDMusicBox')
        #self.assertFalse(self.driver.is_app_installed("com.TONLYELE.YDMusicBox"))
        
if __name__ == '__main__':
    suite = unittest.TestSuite()
    #suite.addTest(uninstall_install("test_remove_app"))
    suite.addTest(uninstall_install("test_install_app"))
    runner = unittest.TextTestRunner()
    runner.run(suite)
    